﻿create PROCEDURE Sync.SP_CommitteeBankAccountDeposites_SelectChanges
@LastRowVersion rowversion,
@FilterdColumn UNIQUEIDENTIFIER
AS 
BEGIN 
	SELECT 
        t.[CommitteeBankAccountDepositID],
		g.[CommitteeBankAccountID],g.[DepositDate],g.[OperationNumber],g.[Notes],
		t.IsDeleted,
		t.LastUpdatedDate
	FROM [dbo].[CommitteeBankAccountDeposites] g RIGHT JOIN Sync.CommitteeBankAccountDeposites_Tracking t  
    ON t.CommitteeBankAccountDepositID = g.CommitteeBankAccountDepositID 
    join CommitteeBankAccount on CommitteeBankAccount.CommitteeBankAccountID = g.CommitteeBankAccountID 
	WHERE (@LastRowVersion IS NULL OR t.Version > @LastRowVersion)
	AND ((@FilterdColumn IS NULL) OR (CommitteeBankAccount.CommitteeID = @FilterdColumn))
    END











